package com.dw.web.dto;

import lombok.Data;

/**
 * @author zhangjing
 * @date 2020/8/21 15:48
 * @Description
 */
@Data
public class Response {

    private int code;

    private String message;

    private Object data;

    public Response() {}

    public Response(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Response error(String message) {
        return new Response(99999, message, null);
    }

    public static Response unAuthorized() {
        return new Response(99997, "权限不足", null);
    }

    public static Response success(Object data) {
        return new Response(200, "成功", data);
    }

    public static Response success() {
        return new Response(200, "成功", null);
    }
}
